﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Agile.DataAccess
{
    /// <summary>
    /// 
    /// </summary>
	public class QueryBuilderData : BuilderData
	{
        /// <summary>
        /// 
        /// </summary>
		public int PagingCurrentPage { get; set; }
        /// <summary>
        /// 
        /// </summary>
		public int PagingItemsPerPage { get; set; }
        /// <summary>
        /// 
        /// </summary>
		public string Having { get; set; }
        /// <summary>
        /// 
        /// </summary>
		public string GroupBy { get; set; }
        /// <summary>
        /// 
        /// </summary>
		public string Orderby { get; set; }
        /// <summary>
        /// 
        /// </summary>
		public string From { get; set; }
        /// <summary>
        /// 
        /// </summary>
		public string Select { get; set; }
        /// <summary>
        /// 
        /// </summary>
		public string WhereSql { get; set; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="objectName"></param>
		public QueryBuilderData(IDbCommand command, string objectName) : base(command, objectName)
		{
			Having = "";
			GroupBy = "";
            Orderby = "";
			From = "";
			Select = "";
			WhereSql = "";
			PagingCurrentPage = 1;
			PagingItemsPerPage = 0;
		}

		internal int GetFromItems()
		{
			return (GetToItems() - PagingItemsPerPage + 1);
		}

		internal int GetToItems()
		{
			return (PagingCurrentPage*PagingItemsPerPage);
		}

	}
}
